//
//  HWCommentTableViewCell.m
//  JWC
//
//  Created by lanou on 16/4/11.
//  Copyright © 2016年 陈帅. All rights reserved.
//

#import "HWCommentTableViewCell.h"
#import "UIImageView+WebCache.h"
#import "HWUserModel.h"

@interface HWCommentTableViewCell ()
@property (weak, nonatomic) IBOutlet UIImageView *headImg;
@property (weak, nonatomic) IBOutlet UIImageView *sex;
@property (weak, nonatomic) IBOutlet UILabel *name;
@property (weak, nonatomic) IBOutlet UIButton *like;
@property (weak, nonatomic) IBOutlet UILabel *likeCount;
@property (weak, nonatomic) IBOutlet UIButton *play;
@property (weak, nonatomic) IBOutlet UILabel *content;


@end

@implementation HWCommentTableViewCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

// 使cell一定成为第一响应者
- (BOOL)canBecomeFirstResponder
{
    return YES;
}

// 支持的方法
- (BOOL)canPerformAction:(SEL)action withSender:(id)sender
{
    return NO;
}


- (void)setModel:(HWCommentModel *)model
{
    _model = model;
    
    [self.headImg setHeader:model.user.profile_image];
    self.sex.image = [model.user.sex isEqualToString:@"m"] ? [UIImage imageNamed:@"Profile_manIcon"] : [UIImage imageNamed:@"Profile_womanIcon"];
    self.play.hidden = YES;
    self.content.text = model.content;
    self.name.text = model.user.username;
    self.likeCount.text = model.like_count;
    
    CGFloat modelH = [self.content.text boundingRectWithSize:CGSizeMake(204, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:14]} context:nil].size.height;
    
    model.cellHeight = 50 + modelH;
}


@end


















